

#include "resulttiny.h"

using namespace Tester;

ResultTiny::ResultTiny(std::ostream &out) : out(out) {}

void ResultTiny::initTestCase(const char *name, const char *file) {
   nameTestCase = name;
   if(file) this->file = file;
}

void ResultTiny::unexpected(const char *nameMethod, unsigned int count, const char *what) {
   out << "Error: " << nameTestCase;

   if(!file.empty()) out << " (" << file << ")";
   out << " " << nameMethod << std::endl;
}

void ResultTiny::fail(const char *nameMethod, unsigned int count, 
      const char *typeFail, int line) {}

void ResultTiny::pass(const char *nameMethod) {
   ++numPass;
}

void ResultTiny::error(const char *nameMethod, const char *nameStage, const char *what) {

   out << "Error: " << nameTestCase;

   if(!file.empty()) out << " (" << file << ")";
   out << " " << nameMethod << "[" << nameStage << "]" << std::endl;
}

void ResultTiny::finishTestCase(unsigned int numTests) {

   out << nameTestCase;

   if(!file.empty()) out << " (" << file << ")";
   out << " " << numPass << " of " << numTests << std::endl;

   numPass = 0;
}

ResultTiny::~ResultTiny() {}


